<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>

<form action="#" class="layui-form layui-col-space5" id="form-draft-edit" method="post">

    <div class="layui-block ">
        <textarea  placeholder="请输入驳回理由" cols="10" rows="20"class="layui-textarea"  name="reason" ></textarea>
    </div>
    <input th:value="${ids}" name="id" type="hidden" />
    <button  class="layui-btn layui-btn-normal" id="subbtn" type="submit" style="margin-left:15px">
        确定
    </button>
</form>


<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>
<!--/_footer 作为公共模版分离出去-->
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({

        });
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });

    $(function () {
        $("#form-draft-edit").validate({
            rules: {
                reason:
                    {
                        required: true,
                    },
            },
            submitHandler:
                function (form) {
                    $(form).ajaxSubmit({
                        type: 'POST',
                        url: "/admin/videoLeader/AuViLeaderFailedReason",
                        success: function (data) {
                            console.log("数据"+data);
                            if (data.code == "1") {
                                selfmsg('驳回成功!', 1, function () {
                                    var index = parent.layer.getFrameIndex(window.name);
                                    parent.location.reload();
                                    parent.layer.close(index);
                                });
                            } else {
                                selfmsg('驳回失败!');
                            }
                        },
                        error: function () {
                            selfmsg('驳回异常!', 5);
                        }
                    });
                }
        })
    })
</script>
</body>
</html>